package ifosup.thibault.http;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class http {

	//static URL url;
	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		
		URL url = new URL("http://www.clubic.com");
		//URLConnection connexion = url.openConnection();
		HttpURLConnection httpconnexion = (HttpURLConnection)url.openConnection();
		System.out.println(httpconnexion.getHeaderFields());
		for (String key : httpconnexion.getHeaderFields().keySet())
				{
			System.out.println(key+"------"+httpconnexion.getHeaderField(key));
				}
		InputStream in = httpconnexion.getInputStream();
		int c =0;		
		StringBuffer sb = new StringBuffer();
		
		while((c=in.read())>-1)
		{
			sb.append((char)c);
		}
System.out.println(sb);
		
		System.out.println(httpconnexion.getInputStream());
		System.out.println(httpconnexion.getDate());
		System.out.println(httpconnexion.getContent());
		System.out.println(httpconnexion.getInstanceFollowRedirects());
		
		//System.out.println(connexion.getInstanceFollowRedirects());

	}

}
